import static java.lang.Thread.sleep;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-07-14
 * Time: 22:39
 */
public class Test3 {
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            System.out.println("线程开始");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("线程结束");
        });
        //t.setDaemon(true);
        t.start();
        System.out.println(t.isAlive());
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        //System.out.println("线程结束");
        System.out.println(t.isAlive());
        /*System.out.println("ThreadId: " + t.getId());
        System.out.println("ThreadName: " + t.getName());
        System.out.println("ThreadState: " + t.getState());
        System.out.println("ThreadPriority: " + t.getPriority());*/


    }
}
